/**
 * @author Young
 */
$(function(){
	var username=$('#username').val();
	//表单验证
    $('.form').validate({
        rules: {
            old_psw: {
                required: true,
                minlength: 6,
                remote:'EmployeeServlet?op_type=valicate&kind=psw&username='+username
            },
            new_psw:{
            	required: true,
            	minlength: 6,
            	equalTo:"#new_psw_confirm"
            },
            new_psw_confirm:{
            	required: true,
            	minlength: 6,
            	equalTo:"#new_psw"
            }
        },
        messages: {
            old_psw: {
                required: '原密码不能为空',
                minlength: '最小长度6',
                remote:'密码不正确'
            },
            new_psw: {
                required: '必填',
                minlength: '最小长度6',
                equalTo: '两次输入密码不同'
            },
            new_psw_confirm: {
                required: '必填',
                minlength: '最小长度6',
                equalTo: '两次输入密码不同'
            }
        }
    });
    /* 设置默认属性 */
    $.validator.setDefaults({
        submitHandler: function(form){
            form.submit();
        }
    });
    
});
